{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Load Data**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv('C:/Users/irene/Dropbox/! RENEWABLE ENERGY/DATA/final_la_haute_R0711.csv')\n",
    "df['Date'] = pd.to_datetime(df['Date_time'])\n",
    "df['Year'] = df['Date'].dt.year \n",
    "df['Month'] = df['Date'].dt.month \n",
    "new_data=df[['Month','Year','Date','P_avg']]\n",
    "new_data=new_data[new_data.Year == 2017]\n",
    "\n",
    "cap=max(new_data['P_avg'])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Parameter Settings**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "i=[1] #enter month value, i.e January = 1\n",
    "look_back=6\n",
    "data_partition=0.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from myfunctions_france import svr_model,ann_model,rf_model,lstm_model,emd_lstm,eemd_lstm,ceemdan_lstm,proposed_method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "CUDA_VISIBLE_DEVICES=\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    5.459116\n",
      "RMSE 165.74305818893225\n",
      "MAE 111.94899554706015\n"
     ]
    }
   ],
   "source": [
    "svr_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 3.720925154372684\n",
      "RMSE 112.38713681576336\n",
      "MAE 76.3042642347646\n"
     ]
    }
   ],
   "source": [
    "ann_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    4.406569\n",
      "RMSE 122.08933116295262\n",
      "MAE 90.36463111930883\n"
     ]
    }
   ],
   "source": [
    "rf_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 3.4453956922908633\n",
      "RMSE 107.38216641203958\n",
      "MAE 70.65403693727458\n"
     ]
    }
   ],
   "source": [
    "lstm_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.656105\n",
      "RMSE 53.003706733665275\n",
      "MAE 33.96141549169435\n"
     ]
    }
   ],
   "source": [
    "emd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.681375\n",
      "RMSE 53.22087121490643\n",
      "MAE 34.47961174865176\n"
     ]
    }
   ],
   "source": [
    "eemd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.577623\n",
      "RMSE 58.53663190584005\n",
      "MAE 32.35199695924829\n"
     ]
    }
   ],
   "source": [
    "ceemdan_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.18783\n",
      "RMSE 35.12141941051707\n",
      "MAE 24.358597760602798\n"
     ]
    }
   ],
   "source": [
    "proposed_method(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
